import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        taskList:[]
    },
    mutations: {
        getTasklist(state,list) {
            state.taskList.push(list)
        },
        delTasklist(state,index) {
            state.taskList.splice(index,1)
        }
    },
    plugins: [createPersistedState({
        key: "myVuex", // 指定名称 默认vuex
        paths: ["taskList"],
        storage:window.localStroage, // 默认localStroage   sessionStorage   cookie
      })],
})
